{include file='public/_meta'}
    <title>添加项目分类</title>
</head>
<body>
<div class="page-container">
    <form action="adddo.html" method="post" class="form form-horizontal" id="form-xmfl-add">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">
                <span class="c-red">*</span>
                分类名称：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" value="" placeholder="" id="title" name="title">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">
                <span class="c-red">&nbsp; </span>
                备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <textarea name="desc" cols="" rows="" class="textarea"  placeholder="介绍分类存放的内容...最少输入10个字符" onKeyUp="$.Huitextarealength(this,100)"></textarea>
                <p class="textarea-numberbar"><em class="textarea-length">0</em>/100</p>
            </div>
        </div>
        <div class="row cl">
            <div class="col-9 col-offset-2">
                <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
            </div>
        </div>
    </form>
</div>
<!--_footer 作为公共模版分离出去-->
{include file='public/_footer'}
<!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__PUBLIC__lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="__PUBLIC__lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="__PUBLIC__lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript">
    $(function(){

        $("#form-xmfl-add").validate({
            rules:{
                title:{
                    required:true,
                },
            },
            //onkeyup:false,
            //focusCleanup:true,
            //success:"valid",
            submitHandler:function(form){
                /**
                 * 成功之后的回调函数
                 * @type {{success: options.success}}
                 */
                var options = {
                    success: function (data) {
                        var dataobj =  JSON.parse(data);
                        if(parseInt(dataobj.statusCode)==200){
                            layer.msg(dataobj.message,{icon:1,time:1000});
                            setInterval("closeWindow()",1000);
                            return true;
                        }else{
                            layer.msg(dataobj.message,{icon:5,time:1000});
                            return false;
                        }
                    }
                };
                $(form).ajaxSubmit(options);
            }
        });
    });
    function closeWindow(){
        var index = parent.layer.getFrameIndex(window.name);
        window.parent.location.reload();
    }
</script>
</body>
</html>